//
//  LhHeightForContent.m
//  Project_B
//
//  Created by dllo on 15/12/23.
//  Copyright © 2015年 ZY. All rights reserved.
//

#import "LhHeightForContent.h"

@implementation LhHeightForContent
+ (CGFloat)heightForContent:(NSString *)content font:(CGFloat)font width:(CGFloat)width{
    //参数1.设置计算高度按照什么样的size来计算
    //注意:宽度一定与label一致,高度尽量大一些
    //参数2.设置计算类型
    //参数3.设置计算内容按照多大的字体计算
    //注意:字体大小也要跟label字体一样
    //参数4.系统备用参数,设置为nil;
    CGSize size = CGSizeMake(width,10000 );
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:font],NSFontAttributeName, nil];
    CGRect frame =  [content boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    
    return frame.size.height;
    
}
@end
